package anji.plus.system.mark.common.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@SpringBootConfiguration
public class WebConfigurer implements WebMvcConfigurer {

    @Resource
    private GlobalInterceptor globalInterceptor;

/*    @Resource
    private DuplicateSubmitInterceptor duplicateSubmitInterceptor;*/

    private static final Logger LOGGER = LoggerFactory.getLogger(WebConfigurer.class);

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
    }

    /***
     * @Description: 这个方法用来注册拦截器，我们自己写好的拦截器需要通过这里添加注册才能生效
     * @Author: luwei
     * @Date: 2022/9/9 19:27
     * @Param registry:
     * @return: void
     * @Version: 1.0
     **/
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(globalInterceptor).
                addPathPatterns("/**").
                excludePathPatterns("/sys/user/login")
                .excludePathPatterns("/sys/user/quit")
                .excludePathPatterns("/sys/flag/queryTeamFlag")
                .excludePathPatterns("/sys/flag/queryFlagList")
                .excludePathPatterns("/sys/task/userScoreRank2")
                .excludePathPatterns("/sys/task/list")
                .excludePathPatterns("/sys/task/personQuery")
                .excludePathPatterns("/sys/taskNode/details")
                .excludePathPatterns("/sys/task/listAndNode")
                .excludePathPatterns("/sys/task/personQuery")
                .excludePathPatterns("/sys/task/personQueryPC")
                .excludePathPatterns("/sys/task/userAuditTask");


    }



}
